package com.hluobo.library.action;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.json.JSONObject;

import com.hluobo.library.service.BorrowLogService;
import com.hluobo.library.util.StreamTool;
import com.hluobo.library.vo.BorrowVo;
import com.opensymphony.xwork2.ActionSupport;

public class TestJsonListAction extends ActionSupport {
	private int uid;
	private  BorrowLogService bLogService;
	private List<BorrowVo> bvs = new ArrayList<BorrowVo>();

	public BorrowLogService getbLogService() {
		return bLogService;
	}

	@Resource(name = "borrowLogService")
	public void setbLogService(BorrowLogService bLogService) {
		this.bLogService = bLogService;
	}

	@Override
	public String execute() throws Exception {
		
		try {
			JSONObject params = StreamTool.readRequstString();
			int userId = params.getInt("userId");
			bvs = bLogService.query(userId);
		} catch (Throwable e) {
			e.printStackTrace();
		}
		
		return SUCCESS;
	}
	
	public String test() throws Exception {
		bvs = bLogService.query(uid);
		return "success";
	}

	public List<BorrowVo> getBvs() {
		return bvs;
	}

	public void setBvs(List<BorrowVo> bvs) {
		this.bvs = bvs;
	}

	public int getUid() {
		return uid;
	}

	public void setUid(int uid) {
		this.uid = uid;
	}

}
